package org.example.leetcode.common.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * MetaObjectConfig
 *
 * @author admin
 * @version 2023/11/29 10:15
 **/
@Component
public class MetaObjectConfig implements MetaObjectHandler {

    @Override
    public void insertFill(MetaObject metaObject) {
//        strictInsertFill(metaObject, "isDeleted", String.class, "N");
        strictInsertFill(metaObject, "create_time", Date.class, new Date());
    }

    @Override
    public void updateFill(MetaObject metaObject) {
//        strictInsertFill(metaObject, "isDeleted", String.class, "N");
        strictInsertFill(metaObject, "createTime", Date.class, new Date());
    }
}
